[PERL Tk] printing Line number in Text widget
Posted
by ungalnanban
on Stack Overflow
See other posts from Stack Overflow
or by ungalnanban
Published on 2010-05-10T12:18:31Z
Indexed on
2010/05/10
12:24 UTC
Read the original article
Hit count: 280
perl
I use the following code for printing the line number in Text widget.
my $c=0; my $r=0;
$txt = $mw->Text( -background =>'white',
-width=>400, -height=>300, -selectbackground => 'skyblue', -insertwidth => 5, -borderwidth =>3, -highlightcolor => 'blue', ### after visit -highlightbackground => 'red' , ### default before visit -xscrollcommand => sub { print"CHAT NO :",$c++; }, # Determines the callback used when the Text widget is scrolled
horizontally. -yscrollcommand => sub { print"LINR NO:",$r++; }, # Determines the callback used when the Text widget is scrolled vertically. -padx => 5, -pady => 5, )-> pack ();
the above code is printing the line number and character no is ok.
but I used in Scrolled widget that output is not printing. what is the problem in the following code how can I solve this?
$txt = $mw->Scrolled('Text', -scrollbars => 'se', -background =>'white',
-width=>400,
-height=>300,
-insertwidth => 5,
-borderwidth =>3,
-highlightcolor => 'blue', ### after visit
-highlightbackground => 'red' , ### default before visit
-padx => 5,
-pady => 5,
-xscrollcommand => sub { print"CHAT NO :",$c++; },
# Determines the callback used when the Text widget is scrolled horizontally.
-yscrollcommand => sub { print"LINR NO :",$r++; },
# Determines the callback used when the Text widget is scrolled vertically.
)->pack();
© Stack Overflow or respective owner